package Day016_字符流_Properties类.ZuoYe;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

/**
 * @author zhangyan
 * @date 2020/5/8 14:53
 */
public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        //创建字符输出流对象
        //捕获异常
        try ( FileWriter fw = new FileWriter("Demo02\\aaa\\Info.txt")){
            //循环 写数据
            while (true){
                System.out.println("请输入信息(886结束输入):");
                String s = sc.next();
                if (s.equals("886")){
                    return;
                }
                fw.write(s + "\r\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        //自动关闭流
    }
}
